﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QualityEvaluatingTools.model;
using System.Xml.Linq;
using QualityEvaluatingTools.helper;

namespace QualityEvaluatingTools.manager
{
    /// <summary>
    /// by dlli2
    /// </summary>
    public class CalculateManager
    {
        /// <summary>
        ///获取意志力得分
        /// </summary>
        /// <param name="evaluation">综合测评大项</param>
        /// <param name="xDocument"></param>
        /// <returns></returns>
        public static EvaluationItem GetYiZhiLiScore(Evaluation evaluation, IEnumerable<XElement> xDocument)
        {
            //定义意志力测评
            EvaluationItem evaluationItem = new EvaluationItem();
            //得分
            int socre = 0;
            //计算得分
            foreach (var item in evaluation.StuAnswerList)
            {
                socre += XmlHelper.GetStuSelectScore(item, xDocument);
            }
            evaluationItem.Score = socre;
            //这里将会使用枚举，暂时这么干
            evaluationItem.Name = "意志力测评";

            return evaluationItem;
        }

        /// <summary>
        ///获取自制力得分
        /// </summary>
        /// <param name="evaluation">综合测评大项</param>
        /// <param name="xDocument"></param>
        /// <returns></returns>
        public static EvaluationItem GetZiZhiLiScore(Evaluation evaluation, IEnumerable<XElement> xDocument)
        {
            //定义意志力测评
            EvaluationItem evaluationItem = new EvaluationItem();
            //得分
            int socre = 0;
            //计算得分
            foreach (var item in evaluation.StuAnswerList)
            {
                socre += XmlHelper.GetStuSelectScore(item, xDocument);
            }
            evaluationItem.Score = socre;
            //这里将会使用枚举，暂时这么干
            evaluationItem.Name = "自制力测评";

            return evaluationItem;
        }

        /// <summary>
        ///获取自制力得分
        /// </summary>
        /// <param name="evaluation">综合测评大项</param>
        /// <param name="xDocument"></param>
        /// <returns></returns>
        public static EvaluationItem GetXinLiShiYingNengLiScore(Evaluation evaluation, IEnumerable<XElement> xDocument)
        {
            //定义意志力测评
            EvaluationItem evaluationItem = new EvaluationItem();
            //得分
            int socre = 0;
            //计算得分
            foreach (var item in evaluation.StuAnswerList)
            {
                socre += XmlHelper.GetStuSelectScore(item, xDocument);
            }
            evaluationItem.Score = socre;
            //这里将会使用枚举，暂时这么干
            evaluationItem.Name = "心里适应能力";

            return evaluationItem;
        }

        /// <summary>
        ///获取自制力得分
        /// </summary>
        /// <param name="evaluation">综合测评大项</param>
        /// <param name="xDocument"></param>
        /// <returns></returns>
        public static EvaluationItem GetLeGuanZhiShuScore(Evaluation evaluation, IEnumerable<XElement> xDocument)
        {
            //定义意志力测评
            EvaluationItem evaluationItem = new EvaluationItem();
            //得分
            int socre = 0;
            //计算得分
            foreach (var item in evaluation.StuAnswerList)
            {
                socre += XmlHelper.GetStuSelectScore(item, xDocument);
            }
            evaluationItem.Score = socre;
            //这里将会使用枚举，暂时这么干
            evaluationItem.Name = "乐观指数";

            return evaluationItem;
        }

        /// <summary>
        ///获取自制力得分
        /// </summary>
        /// <param name="evaluation">综合测评大项</param>
        /// <param name="xDocument"></param>
        /// <returns></returns>
        public static EvaluationItem GetZhiLICePingScore(Evaluation evaluation, IEnumerable<XElement> xDocument)
        {
            //定义意志力测评
            EvaluationItem evaluationItem = new EvaluationItem();
            //得分
            int socre = 0;
            //计算得分
            foreach (var item in evaluation.StuAnswerList)
            {
                socre += XmlHelper.GetStuSelectScore(item, xDocument);
            }
            evaluationItem.Score = socre;
            //这里将会使用枚举，暂时这么干
            evaluationItem.Name = "乐观指数";

            return evaluationItem;
        }
    }
}
